package com.mysoft.gfyx.clue.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mysoft.framework.common.util.MappingUtil;
import com.mysoft.framework.service.AppService;
import com.mysoft.gfyx.clue.dao.OpptySubsCustomerDataDao;
import com.mysoft.gfyx.clue.dao.entity.OpptySubsCustomerData;
import com.mysoft.gfyx.clue.dao.entity.Opptysubs;
import com.mysoft.gfyx.clue.service.OpptySubsCustomerDataService;
import com.mysoft.gfyx.clue.service.dto.OpptySubsCustomerDataDto;
import com.mysoft.gfyx.clue.service.dto.PushDataStatDto;
import com.mysoft.gfyx.clue.service.dto.SubsNameDto;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;
@Service

/**
* 描述：OpptySubsCustomerData 业务代码
* @author JavaSdk generator
* @date 2022-07-07
*/
public class OpptySubsCustomerDataServiceImp extends AppService implements OpptySubsCustomerDataService {

    @Resource
    private OpptySubsCustomerDataDao opptySubsCustomerDataDao;


    @Override
    public boolean updatePush(UUID opptySubsGUID) {
        int r = opptySubsCustomerDataDao.updatePush(opptySubsGUID);
        return true;
    }

    @Override
    public PushDataStatDto pushDataStat(UUID opptySubsGUID) {
        QueryWrapper<OpptySubsCustomerData> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("OpptySubsGUID", opptySubsGUID);
        queryWrapper.eq("IsPush", 0);
        queryWrapper.last("limit 1000");
        PushDataStatDto pushDataStatDto = new PushDataStatDto();
        List<OpptySubsCustomerData> opptySubsCustomerDataList = opptySubsCustomerDataDao.selectList(queryWrapper);
        for (OpptySubsCustomerData opptySubsCustomerData : opptySubsCustomerDataList) {
            pushDataStatDto.setTotal(pushDataStatDto.getTotal()+1);
        }
        return pushDataStatDto;
    }
}
